﻿@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_LayoutBreakingHome.cshtml";
}

<div class="container-fluid">
    <div class="row-fluid">
        <div class="span12">
            <h4>Submit a New Story</h4>
            <div class="alert alert-info">
                <h4>Please follow a few simple guidelines to make this site a better place:!</h4>
                <p>
                    <div class="control-group">
                        <label> Quality Content:  Is your story relevant to the site?</label>
                    </div>
                    <div class="control-group">
                        <label> Link Directly to the Source: Save people time by linking directly to the original news story.</label>
                    </div>
                    <div class="control-group">
                        <label> Search First:  Avoid duplicate submissions by searching to make sure someone else has not submitted the story already.</label>
                    </div>
                    <div class="control-group">
                        <label> Be Descriptive:   has not submitted the story already.</label>
                    </div>
                </p>
            </div>
        </div>
        
    </div><div class="row-fluid">
        <div class="span12">
            <h4>Source for Anything.</h4>
            @using (Html.BeginForm("GetUrlDetail","Submit", method:FormMethod.Get))
            {
                <div class="control-group">
                    <label class="control-label" for="textfield"><h6>Unique URL</h6></label>
                    <div class="controls">

                        <input type="text" class="span6" placeholder="http://www.abc.com/acdce/" id="textfield" name="url">
           </div>
            <input value="Submit" id="submit-url" class="btn btn-primary" type="submit" />
                </div>}


        </div>
    </div>

</div>
<script>

    //$("#submit-url").live("click", function() {
    //    var isUrl = ValidUrl(status);
    //    if (isUrl) {
    //        var url = "/Profile/StreamData?url=" + status;
    //        $.ajax({
    //            url: url,
    //            type: "POST",
    //            success: function(data) {
    //                //alert(data);
    //                $("#preview-display").css("display","block");
    //                $("#preview-display").html(data.view);
    //                var feedSourceDetailNew = new FeedSourceDetail();
    //                feedSourceDetailNew.Embed = data.embed;
    //                feedSourceDetailNew.Title = data.title;
    //                feedSourceDetailNew.Body = data.body;
    //                source = data.source;
    //                feedSourceDetailNew.ImageUrl = data.image;

    //                feedSourceDetail = feedSourceDetailNew;

    //                // $("#Postsource").val("s");
    //                $("#txtMessage").val("");
    //            },
    //            error: function(data){
    //                alert("An error Occurred!!!");
    //            }
    //        });

    //}
    //var status = self.newMessage();

    function ValidUrl(str) {
        var pattern = new RegExp('^(https?:\\/\\/)?' + // protocol
        '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // domain name
        '((\\d{1,3}\\.){3}\\d{1,3}))' + // OR ip (v4) address
        '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // port and path
        '(\\?[;&a-z\\d%_.~+=-]*)?' + // query string
        '(\\#[-a-z\\d_]*)?$', 'i'); // fragment locator
        if (!pattern.test(str)) {
            return false;
        } else {
            return true;
        }
    }

</script>